public class Test {
    public static void hanoi(int n, char from, char temp, char to) {
        if (n == 1) {
            System.out.println("Move disk 1 from " + from + " to " + to);
        } else {
            hanoi(n - 1, from, to, temp);
            System.out.println("Move disk " + n + " from " + from + " to " + to);
            hanoi(n - 1, temp, from, to);
        }
    }

    public static void main(String[] args) {
        int numDisks = 3;
        hanoi(numDisks, 'A', 'B', 'C');
    }
}